package org.dna.uimodel;

import org.apache.wicket.model.LoadableDetachableModel;
import org.dna.MetroApplication;
import org.dna.metronomo.persistence.Activity;

/**
 * Implementation of a LoadableDetachableModel for the Activity entity.
 * */
public class LoadableActivityModel extends LoadableDetachableModel<Activity> {
	private static final long serialVersionUID = -6085236014341544883L;

	private int m_id;

	public LoadableActivityModel(Activity act) {
		super(act);
		m_id = act.getId();
	}

	@Override
	protected Activity load() {
		Activity act = MetroApplication.get().getActivityDAO().queryActivityByID(m_id);
		return new SelectableActivity(act);
	}
}
